/*
 * Copying and distribution of this file, with or without modification,
 * are permitted in any medium without royalty provided this notice is
 * preserved.  This file is offered as-is, without any warranty.
 * Names of contributors must not be used to endorse or promote products
 * derived from this file without specific prior written permission.
 */


#include <stdlib.h>
#include <check.h>
#include "PlanetWars2dRT-core/utils/bool.h"


START_TEST(test_true)
{
  ck_assert(true);
  ck_assert(!(!true));
  
  if(true)
    {
      ck_assert(true);
    }
  else
    {
      ck_assert(false);
    }
}
END_TEST

START_TEST(test_false)
{
  ck_assert(!false);
  ck_assert(!(!(!false)));
  
  if(false)
    {
      ck_assert(false);
    }
  else
    {
      ck_assert(true);
    }
}
END_TEST


Suite*
bool_suite(void)
{
  Suite* s = suite_create("Boolean");
  
  TCase* tc_obvious = tcase_create("Obvious");
  tcase_add_test(tc_obvious, test_true);
  tcase_add_test(tc_obvious, test_false);
  suite_add_tcase(s, tc_obvious);
  
  return s;
}

int
main(void)
{
  size_t number_failed;
  Suite* s;
  SRunner* sr;

  s = bool_suite();
  sr = srunner_create(s);
  
  srunner_run_all(sr, CK_NORMAL);
  number_failed = srunner_ntests_failed(sr);
  srunner_free(sr);
  
  return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
